home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MYMUD21.ZIP / MMUD21.ZIP / SOURCE / 11_STUFF.ZIP / ML_IO.ZIP / MYIO.PAS < prev    next >
Pascal/Delphi Source File  |  1993-07-05  |  2KB  |  136 lines

  1. Unit MYIO;
  2. interface
  3. Uses CRT,
  4.      Dos,
  5.      Foreign,
  6.      VGAFont,
  7.      Header;
  8.  
  9. Procedure My_ReadLn(Var S : String);
  10. Function My_KeyPressed:Boolean;
  11. Function My_ReadKey:Char;
  12. Procedure My_Write(S : String);
  13. Procedure My_WriteLn(S : String);
  14. Procedure My_ClrEol;
  15. Procedure My_Delay(D : LongInt);
  16. Procedure My_ClrScr;
  17.  
  18. Implementation
  19.  
  20. Function ScrollLock:Boolean;
  21. Begin
  22. ScrollLock:=(Mem[0:$417] and $10)=$10;
  23. End;
  24.  
  25.  
  26. Procedure My_ReadLn(Var S : String);
  27. Var Stop : Boolean;
  28.     Key  : Char;
  29. Begin
  30. S:='';
  31. Stop:=False;
  32. Repeat
  33.  Key:=My_ReadKey;
  34.  Case Key Of
  35.   #00 : Key:=My_ReadKey;
  36.   #27 : Begin
  37.         While S<>'' Do
  38.          Begin
  39.          My_Write(#8' '#8);
  40.          Dec(S[0]);
  41.          End;
  42.         End;
  43.   #13 : Stop:=True;
  44.   #8  : begin
  45.         If S<>''
  46.            then Begin
  47.                 Dec(S[0]);
  48.                 My_Write(#8' '#8);
  49.                 End;
  50.         End;
  51.   Else Begin
  52.        S:=S+Key;
  53.        My_Write(Key);
  54.        End;
  55.  End; {Case}
  56. Until Stop;
  57. My_WriteLn('');
  58. End;
  59.  
  60. Function My_KeyPressed:Boolean;
  61. Begin
  62. My_KeyPressed:=CRT.KeyPressed;
  63. End;
  64.  
  65. Function My_ReadKey:Char;
  66. Var Key : Char;
  67. Begin
  68. Key:=CRT.ReadKey;
  69. If ScrollLock
  70.    Then ForeignKeys(Key);
  71. My_ReadKey:=Key;
  72. End;
  73.  
  74. Procedure My_Write(S : String);
  75. Begin
  76. Write(S);
  77. End;
  78.  
  79. Procedure My_WriteLn(S : String);
  80. Begin
  81. WriteLn(S);
  82. End;
  83.  
  84. Procedure My_ClrEol;
  85. Begin
  86. CRT.ClrEol;
  87. End;
  88.  
  89. Procedure My_ClrScr;
  90. Begin
  91. CRT.ClrScr;
  92. End;
  93.  
  94. Procedure My_Delay(D : LongInt);
  95. Begin
  96. CRT.Delay(D);
  97. End;
  98.  
  99.  
  100. (*--------------------------------------------------------------------------*)
  101. Function ExistFile(FilePath : ComStr):Boolean;
  102. Var Zoek: SearchRec;
  103. Begin
  104. FindFirst(FilePath,AnyFile,Zoek);
  105. ExistFile:=(DosError=0);
  106. End;
  107.  
  108.  
  109. Var SupportFileName : ComStr;
  110.     ExitSave        : Pointer;
  111.  
  112. {$F+}
  113. Procedure MyExit;
  114. {$F-}
  115. Begin
  116. If IsVGAorEGA
  117.    Then ResetVGAFont;
  118. ExitProc:=ExitSave;
  119. End;
  120.  
  121. Begin
  122. ExitSave:=ExitProc;
  123. ExitProc:=@MyEXIT;
  124.  
  125. SupportFileName:=HomeDir+'MyMUD';
  126. If ExistFile(SupportFileName+'.LKY') And
  127.    ReadDefinition(SupportFileName+'.LKY')
  128.    Then UseForeign:=True;
  129.  
  130. If ExistFile(SupportFileName+'.FNT') And
  131.    IsVGAorEGA And
  132.    LoadVGAFont(supportFileName+'.FNT')
  133.    Then;
  134.  
  135. End.
  136.